package com.aaa.ssm.controller;

import com.aaa.ssm.entity.Theme;
import com.aaa.ssm.service.ThemeService;
import com.aaa.ssm.util.Page;
import com.aaa.ssm.util.Result;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;


@RestController
@RequestMapping("theme")
public class ThemeController extends BaseController{
@Resource
    private ThemeService themeService;
    @GetMapping("queryAll")
    public Result queryAll(){
        return success(themeService.queryAll());
    }

    /**
     * 根据添加 倒叙
     * @param page
     * @return
     */
    @PostMapping("sysPage")
    public Result sysPage(@RequestBody Page<Theme> page){
        return success(themeService.SysQueryByParam(page));
    }

    /**
     * 分页带参查询
     * @param page
     * @return
     */
    @PostMapping("queryPage")
    public Result queryPage(@RequestBody Page<Theme> page){
        return success(themeService.queryPage(page));
    }
    @PostMapping("add")
    public Result add(@RequestBody Theme theme){
        return success(themeService.add(theme));
    }
    @PostMapping("update")
    public Result update(@RequestBody Theme theme){
        return  success(themeService.update(theme));
    }
    @PostMapping("delete/{code}")
    public Result deleteById(@PathVariable("code")Integer code){
        return  success(themeService.deleteById(code));
    }
}
